package de.wojenko.sps;

import java.io.File;

import javax.xml.bind.JAXBException;

public class FileSprintDataIOService implements SprintDataIOService<XmlUserStory> {

	public FileSprintDataIOService() {
	}

	@Override
	public SprintData<XmlUserStory> loadSprint(File file) throws JAXBException {
		return JAXBUtils.unmarshall(file, XmlSprint.class, XmlBacklogItemArtefact.class, XmlUserStory.class);
	}
	
	@Override
	public void saveSprint(File file, SprintData<XmlUserStory> sprintData) throws JAXBException {
		if(XmlSprint.class.isInstance(sprintData)) {
			JAXBUtils.marshall(sprintData, file, XmlSprint.class, XmlBacklogItemArtefact.class, XmlUserStory.class);
		} else {
			throw new RuntimeException("Not yet Implemented");
		}
	}
}
